function myready() {
	changeh(document.documentElement.scrollHeight+500);
	$(".deldate").click(function() {
		WdatePicker()
	});
	$(".pages").change(function() {
		if ($(this).val() == 'show') {
			window.location.href = "history.php?xtype=show"
		} else if ($(this).val() == 'useredit') {
			window.location.href = "history.php?xtype=useredit"
		} else if ($(this).val() == 'adminedit') {
			window.location.href = "history.php?xtype=adminedit"
		} else if ($(this).val() == 'agentpeilv') {
			window.location.href = "history.php?xtype=agentpeilv"
		} else if ($(this).val() == 'adminpeilv') {
			window.location.href = "history.php?xtype=adminpeilv"
		}
		return true
	});
	$(".game").change(function() {
		window.location.href = "history.php?xtype=" + $(".pages").val() + "&gid=" + $(".game").val()
	});
	$("a.page").click(function() {
		window.location.href = "history.php?xtype=" + $(".pages").val() + "&gid=" + $(".game").val() + "&page=" + $(this).html()
	});
	$("#clickall").click(function() {
		if ($(this).prop('checked') == true) {
			$(this).parent().parent().parent().find("input:checkbox").attr("checked", true)
		} else {
			$(this).parent().parent().parent().find("input:checkbox").attr("checked", false)
		}
	});
	$("#delselect").click(function() {
		dellogin(1)
	});
	$(".delone").click(function() {
		$("input:checkbox").attr("checked", false);
		$(this).parent().parent().find("input:checkbox").attr("checked", true);
		dellogin(0)
	});
	$(".del").click(function() {
		dellogin('date')
	})
}
function getid() {
	var i = 0;
	var idarr = '[';
	$(".nrtb").find("input:checkbox").each(function() {
		if ($(this).prop('checked') == true) {
			if (i > 0) idarr += ','
			idarr += '"' + $(this).val() + '"';
			i++
		}
	});
	idarr += ']';
	return idarr
}
function dellogin(val) {
	if (val == 'date') {
		var idarr = $(".deldate").val() + "&type=date"
	} else {
		var idarr = getid()
	}
	$.ajax({
		type: 'POST',
		url: 'history.php',
		data: 'xtype=del' + $(".pages").val() + '&id=' + idarr,
		success: function(m) {
			
			if (Number(m) == 1) {
				window.location.href = "history.php?xtype=" + $(".pages").val() + "&gid=" + $(".game").val() + "&page=" + 1
			}
		}
	})
}